package array.leetcode.easy;

/**
 * @author bruin_du
 * @description 调整数组顺序使奇数位于偶数前面
 * @date 2022/5/26 20:28
 **/
public class Offer21_Exchange {
    public int[] exchange(int[] nums) {
        int slow = 0;
        for (int i = 0; i < nums.length; i++) {
            if((nums[i] & 0x1) == 1){
                int tmp = nums[slow];
                nums[slow] = nums[i];
                nums[i] = tmp;
                slow++;
            }
        }
        return nums;
    }
}
